home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 31 / Amiga Format CD31 (1998-09-02)(Future Publishing)(GB)(Track 1 of 2)[!][issue 1998-10].iso / -websites- / sasg / dfa / rexx / dfatowrite.lha / dfatowrite.dfa
Text File  |  1996-06-16  |  3KB  |  79 lines

  1. /*****************************************************************************
  2.  
  3.  Export DFA to Gold Disk's TransWrite Mailmerge File
  4.  
  5.  Based on "export_bt_ii.dfa (c) Dirk Federlein 1994
  6.  
  7.  ** Version: 24/1/95 **     (c) Donald Dalley  1995
  8.  
  9.  Purpose: Exports selected addresses to a mailmerge
  10.           file for TransWrite.
  11.  
  12.  Exports a file in the following format:
  13.  
  14.   First Name
  15.   Company Name * optional *
  16.   Street
  17.   City State
  18.   Country
  19.   ZIP
  20.   >
  21.  
  22.  Feel free to change/re-order them. Also, if you don't enter commas into DFA's
  23.  database, you can change this script and add them to the export file.
  24.  
  25. *****************************************************************************/
  26.  
  27. /* Turn on error checking by uncommenting the following TRACE command.      */
  28.  
  29. OPTIONS RESULTS                         /*  Lets REXX accept RESULT values  */
  30. /* TRACE RESULTS */                     /*  Turn on to check for errors     */
  31.  
  32. exportfile = 't:dfa_TW.export'          /*  assign path:<filename> for WRITE*/
  33.  
  34. IF ~SHOW(PORTS, DFA) THEN EXIT 10       /* _Find port DFA, if not, stop.    */
  35.                                         /* _Don't run DFA more than once!   */
  36.  
  37. IF OPEN('exf',exportfile,'WRITE') THEN DO /* open exportfile in RAM:        */
  38.    ADDRESS 'DFA'                        /*  Get DFA's attentio              */
  39.    FIRST STEM ADR.                      /*  Find first record               */
  40.  
  41.      IF ADR.ADDRESS.24 = 0 THEN         /*  if first record is not selected */
  42.          NEXTSEL STEM ADR.              /*  then find first selected record */
  43.  
  44. /* ---------- This LOOP picks items written to DFA's export file ---------- */
  45.  
  46.      DO WHILE RC = 0                    /*  If there are no errors, write   */
  47.       CALL WRITECH('exf',ADR.ADDRESS.1) /* `first' name  |WriteCh adds no|  */
  48.       CALL WRITECH('exf',' ')           /*  pad space    |carriage return|  */
  49.       CALL WRITELN('exf',ADR.ADDRESS.2) /* `last' name   |WriteLn adds cr|  */
  50.  
  51.     /*CALL WRITELN('exf',ADR.ADDRESS.3)*/ /*   uncomment co name if needed  */
  52.  
  53.       CALL WRITELN('exf',ADR.ADDRESS.4) /* `street'                         */
  54.       CALL WRITECH('exf',ADR.ADDRESS.6) /* `city'                           */
  55.       CALL WRITECH('exf',' ')           /*  pad space                       */
  56.       CALL WRITECH('exf',ADR.ADDRESS.7) /* `state'                          */
  57.       CALL WRITELN('exf',ADR.ADDRESS.8) /* `country'                        */
  58.       CALL WRITELN('exf',ADR.ADDRESS.5) /* `postal code'                    */
  59.       CALL WRITELN('exf','>')           /*  adds merge record seperator ">" */
  60.  
  61.       NEXTSEL STEM ADR.                 /*  go to next selected record      */
  62.  
  63.      END /* DO */
  64.  
  65.      CALL CLOSE ('exf')                 /*  close export file               */
  66.  
  67. END /* DO */
  68.  
  69. /* Give user instructions here */
  70.  
  71. SAY ""                                  /* write blank line to screen       */
  72.  
  73. SAY "The mailmerge file is in RAM:t."
  74.  
  75. SAY "Merge it from there, or SAVE it." 
  76. SAY ""
  77.  
  78. EXIT 0
  79.